#ifndef PIDREGULATORCONFIG_H
#define PIDREGULATORCONFIG_H

#include "parammanager.h"

struct PidRegulatorConfig {
	PidRegulatorConfig()
		: kp(0.0), ki(0.0), kc(0.0), kd(0.0), min(-1.0), max(1.0)
	{}

	float kp;	// proportional gain
	float ki;	// interator gain
	float kc;	// interator anti-windup correction gain
	float kd;	// derivative gain
	float min;	// minimum regulator output
	float max;	// maximum regulator output	

	void ReadParams(ParamManager *params, int index) {
		kp = params->getFloat(index + 0);
		ki = params->getFloat(index + 1);
		kc = ki * 2.0f;
		kd = params->getFloat(index + 2);
		min = params->getFloat(index + 3);
		max = params->getFloat(index + 4);
	}
	
	bool operator==(const PidRegulatorConfig &b) const {
		return
			kp == b.kp &&
			ki == b.ki &&
			kc == b.kc &&
			kd == b.kd &&
			min == b.min &&
			max == b.max;
	}

	bool operator!=(const PidRegulatorConfig &b) const {
		return !operator==(b);
	}
};

#endif
